home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / Xteq X-Setup / xqdcXSP-Setup-EN.exe / {app} / plugins / XQ New File Menu Add.xpl < prev    next >
Text File  |  2001-01-21  |  3KB  |  108 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 5.0"
  2. "TYPE"="5"
  3. "COUNT"="1"
  4. "UIPATH"="Appearance\Files&Folders\"New" Context Menu"
  5. "NAME"="Add Item"
  6. "VERSION"="1.00"
  7. "LANGUAGE"="VBScript"
  8. "TEXT 1"="Add Item to NEW Context Menu"
  9. "DESCRIPTION 1"="This plug-in allows you to add a new file type that is currently not listed inside the NEW menu."
  10. "DESCRIPTION 2"="Please enter the file extension without the beginning ".", e.g. "TXT" (no quotes)."
  11. "AUTHOR"="Xteq Systems"
  12. "CONTACTURL"="http://www.xteq.com"
  13. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  14. "COMMENT 1"=" "
  15.  
  16.  
  17. sP="HKLM\Software\Classes\"
  18. sV_ShellNew="\ShellNew\"
  19.  
  20.  
  21.  
  22. Sub Plugin_Initialize 
  23.  if RegPathExists(sP) then
  24.     '
  25.  else
  26.     Call Disable
  27.  end if
  28. End Sub
  29.  
  30. Sub Plugin_Apply(ElementIndex,ElementSubIndex)
  31.     if ElementIndex=1 then
  32.        s=InputWindow("Please enter the extension of the file type, without the beginning dot, e.g. TXT","TXT",1) 
  33.        if IsEmpty(s)=false then
  34.           sPath=IsShellNew(sP & "." & s)
  35.  
  36.           if len(sPath)>0 then
  37.              Call MsgError("This file type is already registered for use with the NEW context menu and can therefore not be added!")
  38.           else
  39.              If RegPathExists(sP & "." & s)=false then
  40.                 Call MsgError("This file type is not known to your system can therefore not be added!") 
  41.              else
  42.                 sPath=sP & "." & s & sV_ShellNew & "NullFile"
  43.                 Call RegWriteValue(sPath,"",1)
  44.              end if            
  45.           end if
  46.        end if
  47.     end if
  48.  
  49. End Sub
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. 'VERSION 1.1
  57. 'returns the reg path to the ShellNew(-) path or "" if nothing was found. Input is the
  58. 'path to the data type (e.g. "HKCR\.TXT"). 
  59. Function IsShellNew(Path)
  60.  Dim sCheck
  61.  xd_sV_ShellNew="\ShellNew"
  62.  xd_sV_ShellNewDeac="\ShellNew-"
  63.  
  64.  
  65.  'first check on the file itself 
  66.  'HKCR\.XXX\ShellNew
  67.  sCheck=Path & xd_sV_ShellNew
  68.  If RegPathExists(sCheck) then
  69.     IsShellNew=sCheck
  70.  else
  71.     'now check if it's deactivated...
  72.     'HKCR\.XXX\ShellNew
  73.     sCheck=Path & xd_sV_ShellNewDeac
  74.     If RegPathExists(sCheck) then 
  75.        IsShellNew=sCheck
  76.     else
  77.        'maybe it's a little trick file
  78.        s=RegReadValue(Path & "\@")
  79.        if IsEmpty(s)=false then          
  80.           'HKCR\.XXX\XX File\ShellNew
  81.           sCheck=Path & "\" & s & xd_sV_ShellNew
  82.           if RegPathExists(sCheck) then
  83.              IsShellNew=sCheck
  84.           else
  85.              'maybe deactivated?
  86.              sCheck=Path & "\" & s & xd_sV_ShellNewDeac
  87.              if RegPathExists(sCheck) then
  88.                 IsShellNew=sCheck
  89.              else
  90.                 'okay, I give up! I have checked all possibilies...
  91.                 IsShellNew=""
  92.              end if
  93.           end if
  94.        else
  95.           'this value has no name, so it has no ShellNew(-) key..
  96.           IsShellNew=""
  97.        end if 
  98.     end if
  99.  end if
  100.  
  101. End Function
  102.  
  103.  
  104.  
  105.  
  106. Sub Plugin_Terminate 
  107. End Sub
  108.